using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Webcar.BLL;
using ToolsLayer;
using BusinessEntity;

namespace Webcar.Controls.View
{
    public partial class CarSendView : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void InitSendInfo(string sendno)
        {
            CarBLL cb = new CarBLL();
            BS_CAR_SENDEntity sendinfo = cb.GetCarSendInfo(sendno);
            try
            { 
                this.lblRecordNo.Text = cb.GetCar(sendinfo.CarNo).RECORD_NO;
            }
            catch
            {

            }
            PropertyBindings pb = new PropertyBindings();
            pb.EntityObject = sendinfo;
            this.SetBindingInfo(pb);
            pb.SetBindingObjectValue();
            
            InfoChecker ic = new InfoChecker();
            ic.SetInfoReaded(sendno, InfoCheckType.CarSend);
        }

        private void SetBindingInfo(PropertyBindings pb)
        {
            pb.AddRelation(this.tbCheckMan, "CHECK_MAN");
            pb.AddRelation(this.tbPersons, "PERSONS");
            pb.AddRelation(this.tbPlace, "PLACE");
            pb.AddRelation(this.tbReason, "REASON");
            pb.AddRelation(this.tbRemark, "REMARK");
            pb.AddRelation(this.dtendDate, "END_DATE");
            pb.AddRelation(this.dtStartDate, "START_DATE");
            pb.AddRelation(this.ddlDept, "DEPT_CODE");
            pb.AddRelation(this.lblDriverName, "DriverName");
        }
    }
}